package cn.melonlib.cores.graphql.model.ext.scalars;

import lombok.Getter;
import org.jetbrains.annotations.NotNull;

@Getter
public class BytesType implements CharSequence{

    private final String content;

    public BytesType(String content) {
        this.content = content;
    }

    @Override
    public int length() {
        return content.length();
    }

    @Override
    public char charAt(int index) {
        return content.charAt(index);
    }

    @NotNull
    @Override
    public CharSequence subSequence(int start, int end) {
        return content.subSequence(start,end);
    }

    @Override
    public int hashCode() {
        return content.hashCode();
    }

    @Override
    public boolean equals(Object obj) {
        if(obj instanceof BytesType) {
            return content.equals(obj);
        }else{
            return false;
        }
    }

    @Override
    public String toString() {
        return content.toString();
    }
}
